﻿@model EnterpriseAssets.Models.FixedAssetInfo
@{
    ViewBag.Title = "Home Page";
    Html.EnableUnobtrusiveJavaScript();//启用JavaScript
    Html.EnableClientValidation();//开启客户端验证
    String msg = ViewBag.msg;
}

@using (Html.BeginForm("Save", "home", FormMethod.Post))
{
    @Html.ValidationSummary(true)
    <div class="row">
        <div class="col-md-6">
            @*标签显示*@
            @Html.LabelFor(model => model.Brand)：
            @*数据输入框*@
            @Html.EditorFor(model => model.Brand, new { htmlAttributes = new { @class = "form-control Brand" } })
            @*数据验证消息*@
            @Html.ValidationMessageFor(model => model.Brand)
        </div>
        <div class="col-md-6">
            @Html.LabelFor(model => model.Model)：
            @Html.EditorFor(model => model.Model, new { htmlAttributes = new { @class = "form-control Model" } })
            @Html.ValidationMessageFor(model => model.Model)
        </div>
    </div>

    <div class="row">
        <div class="col-md-6">
            @Html.LabelFor(model => model.AssetType)：
            @Html.EditorFor(model => model.AssetType, new { htmlAttributes = new { @class = "form-control AssetType" } })
            @Html.ValidationMessageFor(model => model.AssetType)
        </div>
        <div class="col-md-6">
            @Html.LabelFor(model => model.UsingName)：
            @Html.EditorFor(model => model.UsingName, new { htmlAttributes = new { @class = "form-control" } })
            @Html.ValidationMessageFor(model => model.UsingName)
        </div>
    </div>
    <div class="row">
        <div class="col-md-6">
            @Html.LabelFor(model => model.UsingNameDepartment)：
            @Html.EditorFor(model => model.UsingNameDepartment, new { htmlAttributes = new { @class = "form-control" } })
            @Html.ValidationMessageFor(model => model.UsingNameDepartment)
        </div>
        <div class="col-md-6">
            @Html.LabelFor(model => model.SerialNumber)：
            @Html.EditorFor(model => model.SerialNumber, new { htmlAttributes = new { @class = "form-control" } })
            @Html.ValidationMessageFor(model => model.SerialNumber)
        </div>
    </div>
    <div class="row">
        <div class="col-md-12">
            @Html.LabelFor(model => model.ServiceNumber)：
            @Html.EditorFor(model => model.ServiceNumber, new { htmlAttributes = new { @class = "form-control ServiceNumber" } })
            @Html.ValidationMessageFor(model => model.ServiceNumber)
        </div>
    </div>
    <div class="row">
        <div class="col-md-12">
            <button type="submit" class="btn btn-success">提交添加</button>
        </div>
    </div>
}
@section scripts{
    <script src="~/Scripts/jquery-3.3.1.js"></script> 
    <script src="~/Scripts/jquery.validate.js"></script>
    <script src="~/Scripts/jquery.validate.unobtrusive.js"></script>
    <script>
        $(function () {
            var str = '@msg'//保存成功提示消息
            if (str != undefined && str != '') {
                alert(str);
            }
        })
    </script>
}
<style>
    .row {
        margin-top: 36px;
        margin-bottom: 25px;
    }

    .btn {
        display: block;
        text-align: center;
        margin: 0 auto;
        margin-top: 40px;
    }

    label {
        font-size: 18px;
    }

    .form-control {
        display: inline-flex;
    }

    .field-validation-error {
        color: red;
    }

    .AssetType {
        margin-left: 55px;
    }

    .Brand {
        margin-left: 54px;
    }

    .ServiceNumber {
        margin-left: 18px;
    }

    .Model {
        margin-left: 17px;
    }
</style>